/**
 * 
 */
package cn.biplam.front.template.base;

import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.front.html.HtmlDiv;
import cn.biplam.front.html.HtmlImage;
import cn.biplam.front.html.base.HtmlWindow;
import cn.biplam.front.html.base.Const.Align_Type;
import cn.biplam.front.html.base.Const.Cursor_Type;

/**
 * 图片26*26的按钮
 * @author 	WangSong
 * @create 	2009-4-8 下午05:57:03
 * @version 1.0
 */
public class ButtonImage {
	
	private HtmlDiv button;
	private String imageUrl;
	
	/**
	 * 构造方法
	 * @param ID		页面ID
	 * @param msgText	按钮文本
	 * @param imageUrl	按钮图片
	 * @throws ErrorMessage 
	 */
	public ButtonImage(String ID,String imageUrl) throws ErrorMessage{
		this.button=new HtmlDiv(ID);
		this.button.setStyleHeight("30");
		this.button.setStyleWidth("30");
		this.button.setMarginLeft("5");
		this.button.setLength(35);
		this.button.setMarginTop("2");
		this.imageUrl=imageUrl;
	}
	
	/**
	 * 返回设置好的Html控件
	 * @return HtmlWindow
	 * @throws ErrorMessage 
	 */
	public HtmlWindow get() throws ErrorMessage{
		this.button.setCursor(Cursor_Type.Hand);
		this.button.setAlign(Align_Type.center);
		HtmlDiv image=new HtmlDiv();
		HtmlImage messageImage = new HtmlImage(this.imageUrl);
		image.put(messageImage);
		this.button.put(image);
		messageImage.setSize("26", "26");
		return this.button;
	}

}
